<script lang="ts" setup>
import { ElMessage } from 'element-plus'
// import { getDtail } from '@/api/oss'
import { getPredictDetail } from '@/api/system/predict'
import { resetData, reshowData } from '@/hooks/use-common'
import { i18n } from '@/lang'
const { t } = i18n.global
//element valid
const formRules = useElement().formRules
/** 提交按钮 */
const dettailInfo = ref('')
const open = ref(false)
const title = ref(t('modelConvert.add_model'))
const emits = defineEmits([])
const uploadType = ref(0)

const addEditForm = reactive({
  in_file: '',
  out_file: '',
  create_at: '',
  update_at: '',
  status: ''
})

const formString = JSON.stringify(addEditForm)
// const submitForm = () => {
//   platformRef.value.validate((valid) => {
//     console.log('111111', valid)
//     if (valid) {
//       open.value = false
//       emits('getList')
//     }
//   })
// }
/** 取消按钮 */
const cancel = () => {
  open.value = false
  resetData(addEditForm, formString)
  // emits('getList')
}

const showModal = (row) => {
  open.value = true
  console.log(row)
  if (row.id) {
    getPredictDetail(row.id).then(({ data }) => {
      // open.value = false
      //edit
      reshowData(addEditForm, data)
    })
  }
  title.value = t('modelConvert.file_details')
}

onMounted(() => {})
//导出给refs使用
//用于子组件向其父组件传值
defineExpose({ cancel, showModal })
</script>

<template>
  <div style="font-size: 80px">
    <el-dialog
      v-model="open"
      :title="title"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      :destroy-on-close="true"
      width="500px"
      append-to-body
    >
      <el-form ref="dettailInfo" style="font-size: 20px" :model="addEditForm" label-width="100px" inline disabled>
        <el-form-item :label="t('modelConvert.input_file')" prop="in_file">
          <el-input v-model="addEditForm.in_file" style="width: 250px" />
        </el-form-item>

        <el-form-item :label="t('modelConvert.input_file')" prop="out_file">
          <el-input v-model="addEditForm.out_file" style="width: 250px" />
        </el-form-item>

        <el-form-item :label="t('modelConvert.input_file')" prop="create_at">
          <el-input v-model="addEditForm.create_at" style="width: 250px" />
        </el-form-item>

        <el-form-item :label="t('modelConvert.input_file')" prop="update_at">
          <el-input v-model="addEditForm.update_at" style="width: 250px" />
        </el-form-item>

        <el-form-item :label="t('modelConvert.input_file')" prop="status">
          <el-input v-model="addEditForm.status" style="width: 250px" />
        </el-form-item>
      </el-form>

      <!-- <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button type="primary" @click="cancel">取消</el-button>
      </div>
    </template> -->
    </el-dialog>
  </div>
</template>

<style scoped lang="scss"></style>
